float4x4 World;
float4x4 View;
float4x4 Projection;

float Blend;

float3	EyePosition;			// The position of the viewer.
float3	ViewVector;				// The direction the viewer is looking in.

texture TextureA;
sampler2D textureSamplerA = sampler_state
{
	Texture = (TextureA);
	MipFilter = LINEAR;
	MinFilter = LINEAR;
	MagFilter = LINEAR;
    AddressU = Clamp;
    AddressV = Clamp;
};

texture TextureB;
sampler2D textureSamplerB = sampler_state
{
	Texture = (TextureB);
	MipFilter = LINEAR;
	MinFilter = LINEAR;
	MagFilter = LINEAR;
    AddressU = Clamp;
    AddressV = Clamp;
};

struct VertexShaderInput
{
    float4 Position : POSITION0;
	float2 TextureCoordinate : TEXCOORD0;
    // TODO: add input channels such as texture
    // coordinates and vertex colors here.
};

struct VertexShaderOutput
{
    float4 Position : POSITION0;
    float2 TextureCoordinate : TEXCOORD0;
};

VertexShaderOutput VertexShaderFunction(VertexShaderInput input)
{
    VertexShaderOutput output;

    float4 worldPosition = mul(input.Position, World);
    float4 viewPosition = mul(worldPosition, View);
    output.Position = mul(viewPosition, Projection);
	output.TextureCoordinate = input.TextureCoordinate;
    // TODO: add your vertex shader code here.

    return output;
}

float4 PSBlend(VertexShaderOutput input) : COLOR0
{
	return lerp(tex2D(textureSamplerA, input.TextureCoordinate), tex2D(textureSamplerB, input.TextureCoordinate), Blend);
}

float4 PSNoBlend(VertexShaderOutput input) : COLOR0
{
	return tex2D(textureSamplerA, input.TextureCoordinate);
}

int PixelShaderIndex = 0;

#if WINDOWS
PixelShader pixelShaders[2] = {
	compile ps_2_0 PSBlend(),
	compile ps_2_0 PSNoBlend(),
};
#endif

technique Technique1
{
    pass Pass1
    {
        // TODO: set renderstates here.

        VertexShader = compile vs_1_1 VertexShaderFunction();
        #if WINDOWS
        PixelShader = (pixelShaders[PixelShaderIndex]);
        #else
        PixelShader = compile ps_2_0 PSBlend();
        #endif
    }
}
